﻿<%@ Page Language="C#" MasterPageFile="~/Main.master" CodeBehind="UpdateableList.aspx.cs" Inherits="DD_Extensions.UpdateableList" %>
<%@ Import Namespace="NotAClue" %>

<asp:Content ID="headContent" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
	<asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true">
		<DataControls>
			<asp:DataControlReference ControlID="ListView1" />
		</DataControls>
	</asp:DynamicDataManager>

	<%--<h2 class="DDSubHeader"><%= table.DataContextPropertyName.ToTitleFromPascal() %></h2>
	<h2 class="DDSubHeader"><%= table.Name %></h2>--%>
	<h2 class="DDSubHeader"><%= table.DisplayName %></h2>

	<asp:UpdatePanel ID="UpdatePanel1" runat="server">
		<ContentTemplate>
			<div class="DD">
				<asp:ValidationSummary 
					ID="ValidationSummary1" 
					runat="server" 
					EnableClientScript="true" 
					HeaderText="List of validation errors" 
					CssClass="DDValidator"/>
				<asp:DynamicValidator 
					runat="server" 
					ID="GridViewValidator" 
					ControlToValidate="ListView1" 
					Display="None" 
					CssClass="DDValidator"/>

				<asp:PlaceHolder 
					ID="PlaceHolder1" 
					runat="server">
				</asp:PlaceHolder>
			</div>

			<fieldset id="Filters" class="DD" runat="server" clientidmode="Static">
				<legend>Filters</legend>

				<span id="MultiSearch" class="filter" runat="server" ClientIDMode="Static" visible="false">
					<asp:Label ID="Label1" runat="server" Text="Search" AssociatedControlID="txbMultiColumnSearch" />
					<asp:TextBox ID="txbMultiColumnSearch" CssClass="DDFilter" ClientIDMode="Static" runat="server" />
					<asp:Button ID="btnMultiColumnSearchSubmit" CssClass="DDFilter" runat="server" ClientIDMode="Static" 
						Text="Search" onclick="btnMultiColumnSearch_Click" />
					<asp:Button ID="btnMultiColumnSearchClear" CssClass="DDFilter" runat="server" Text="Clear" 
						OnClick="btnMultiColumnSearch_Click" />&nbsp;
				</span>

				<asp:QueryableFilterRepeater runat="server" ID="FilterRepeater">
					<ItemTemplate>
						<span class="filter"><asp:DynamicFilter runat="server" ID="DynamicFilter" OnFilterChanged="DynamicFilter_FilterChanged" />&nbsp;</span>
					</ItemTemplate>
				</asp:QueryableFilterRepeater>

				<span id="ClearFiltersDiv" runat="server" class="filter RightAlign">
					<asp:Button ID="ClearFiltersButton" runat="server" Text="Clear all filters" 
						CssClass="DDFilter" onclick="ClearFiltersButton_Click"/>
				</span>
			</fieldset>

			<asp:ListView 
				ID="ListView1" 
				runat="server" 
				DataSourceID="GridDataSource" 
				OnItemCommand="ListView1_ItemCommand" 
				OnItemDataBound="ListView1_ItemDataBound" 
				OnItemInserted="ListView1_ItemInserted">
			</asp:ListView>

			<asp:EntityDataSource 
				ID="GridDataSource" 
				runat="server" 
				EnableDelete="true" 
				EnableInsert="true" 
				EnableUpdate="true" onselecting="GridDataSource_Selecting" 
				onupdating="GridDataSource_Updating"/>
			
			<asp:QueryExtender 
				TargetControlID="GridDataSource" 
				ID="GridQueryExtender" 
				runat="server">
				<asp:DynamicFilterExpression ControlID="FilterRepeater" />
			</asp:QueryExtender>

		</ContentTemplate>
	</asp:UpdatePanel>
</asp:Content>

